<?php get_header(); ?>
<?php get_template_part('left','menu');?>
<?php global $uctheme_option;?>

<section>
  <div class="container">
    <div class="left_summary" id="left_side">
      <div class="content_out">
        <div class="content"  id="content">
          <div id="loading" style="width:684px;height:100px;padding-top:100px;text-align:center"><img src="<?php echo get_template_directory_uri();?>/images/loading2.gif" /><br/>
            loading...</div>
          <div id="magic">
            <div class="pic">
              <ul>
                <?php 
            global $uctheme_option;
            $slide1 = $uctheme_option['slide']['slide1']; 
			$slide_link1 = $uctheme_option['slide']['slide_link1']; 
			$slide_word1 = $uctheme_option['slide']['slide_word1']; 
			
            $slide2 = $uctheme_option['slide']['slide2']; 
			$slide_link2 = $uctheme_option['slide']['slide_link2']; 
			$slide_word2 = $uctheme_option['slide']['slide_word2']; 
			
            $slide3 = $uctheme_option['slide']['slide3']; 
			$slide_link3 = $uctheme_option['slide']['slide_link3'];
			$slide_word3 = $uctheme_option['slide']['slide_word3']; 
			 			
            $slide4 = $uctheme_option['slide']['slide4']; 
			$slide_link4 = $uctheme_option['slide']['slide_link4']; 
			$slide_word4 = $uctheme_option['slide']['slide_word4']; 
			
            $slide5 = $uctheme_option['slide']['slide5']; 
			$slide_link5 = $uctheme_option['slide']['slide_link5'];
			$slide_word5 = $uctheme_option['slide']['slide_word5']; 
			 
            $slide6 = $uctheme_option['slide']['slide6']; 
			$slide_link6 = $uctheme_option['slide']['slide_link6']; 
			$slide_word6 = $uctheme_option['slide']['slide_word6']; 		
       ?>
            <li><a href="<?php  echo $slide_link1; ?>" target="_blank" ><img src="<?php  echo $slide1; ?>" alt="<?php  echo $slide_word1; ?>" /></a></li>
            <li><a href="<?php  echo $slide_link2; ?>" target="_blank" ><img src="<?php  echo $slide2; ?>" alt="<?php  echo $slide_word2; ?>" /></a></li>
            <li><a href="<?php  echo $slide_link3; ?>" target="_blank" ><img src="<?php  echo $slide3; ?>" alt="<?php  echo $slide_word3; ?>" /></a></li>
            <li><a href="<?php  echo $slide_link4; ?>" target="_blank" ><img src="<?php  echo $slide4; ?>" alt="<?php  echo $slide_word4; ?>" /></a></li>
            <li><a href="<?php  echo $slide_link5; ?>" target="_blank" ><img src="<?php  echo $slide5; ?>" alt="<?php  echo $slide_word5; ?>" /></a></li>
            <li><a href="<?php  echo $slide_link6; ?>" target="_blank" ><img src="<?php  echo $slide6; ?>" alt="<?php  echo $slide_word6; ?>"/></a></li>
              </ul>
            </div>
          </div>
          <script type="text/javascript" src="<?php echo get_template_directory_uri();?>/js/magic.js"></script>
          <script type="text/javascript">
                myFocus.set({id:'magic', pattern:'mF_kdui'});
          </script>
          <ul class="doubleElevenBox">
            <li class="doubleTitle">当前热门活动</li>
            <?php
		$args = array(
			'echo' => false,
			'container' => false,
			'sort_column' => 'menu_order',
			'menu_id'=>'',
			'menu_class'=>'doubleList',
			'depth'=>1,
			'menu_class'=>'',
			'fallback_cb'=> '',
			'theme_location' => 'hot-menu'		
		);
		$hot_menu = wp_nav_menu($args);
		$hot_menu = preg_replace( array( '#^<ul[^>]*>#', '#</ul>#' ), '', $hot_menu );
		echo $hot_menu;
		?>
          </ul>
          <div class="clear"></div>
          <?php if( have_posts() ) : while( have_posts() ) : the_post();?>
          <?php if( is_sticky() ) :?>
          <div class="leftNotice out_current_top">
            <div class="perContentBox " id="post-<?php echo $post->ID;?>">
              <div class="contentBg">
                <div class="con_title"> <span class="conName"><a href="<?php the_permalink();?>" title="<?php the_title();?>">
                  <?php the_title();?>
                  <span class="red">&nbsp;&nbsp;&nbsp;<?php echo get_post_meta($post->ID,'_red_title',true);?></span></a></span>
                  <div class="clear"></div>
                </div>
              </div>
            </div>
          </div>
          <?php else : ?>
          <div class="perContentBox list_summary "  id="post-<?php echo $post->ID;?>">
            <div class="contentBg ">
              <div class="con_title" style="background-image:url(<?php echo get_template_directory_uri();?>/images/listbgHover.png)" > <span class="conName"><a href="<?php the_permalink();?>" title="<?php the_title();?>">
                <?php the_title();?>
                <span class="red">&nbsp;&nbsp;&nbsp;<?php echo get_post_meta($post->ID,'_red_title',true);?></span></a></span>
                <div class="conTime"><?php echo the_time('m-d  H:i');?></div>
                <div class="clear"></div>
              </div>
              <div class="showLeft">
                <div class="proRightBox">
                  <div class="pro1">
                    <div class="like">
                      <div class="collect">
                        <?php	
                            if( $user_ID != '' && $user_ID > 0 ) { 
                            $results = $wpdb->get_results("SELECT post FROM wp_userpost_fav WHERE user = $user_ID");
                            $user_faves_arr=array();
                            foreach($results as $result)
                            {                                  
                                array_push($user_faves_arr,$result->post);
                            }	
                            if( !in_array( $post->ID, $user_faves_arr ) ) {
                                    ?>
                        <span class="add_fav"><a href="javascript:void(0);" id="<?php echo the_ID(); ?>" title="收藏本文" class="add_to_fav"><?php echo get_post_fav_count($post->ID); ?> </a></span>
                        <?php } else { ?>
                        <span class="add_fav"><a href="javascript:void(0);" id="<?php echo the_ID(); ?>" title="收藏本文" class="add_to_fav"><?php echo get_post_fav_count($post->ID);?> </a></span>
                        <?php } ?>
                        <?php } else {?>
                        <span class="add_fav"><a href="javascript:void(0);" id="<?php echo the_ID(); ?>" title="收藏本文" class="add_to_fav_unlogin"><?php echo get_post_fav_count($post->ID);?> </a></span>
                        <?php }	?>
                      </div>
                      <div class="commentCount">
                        <?php comments_popup_link( '0', '1', '%'); ?>
                      </div>
                      <div class="clear"></div>
                    </div>
                    <div  style="width:150px; height:150px; float:none; text-align:center; padding:5px;border:0px solid #ccc;overflow:hidden; display:table-cell;vertical-align:middle;">
                      <?php
                                if( has_post_thumbnail() ){
                                    echo get_the_post_thumbnail( $post->ID, array(150, 150), array('alt'=>$post->post_title) );
                                }else{
                                    echo '<img  style="max-width:150px;max-height:150px;"   src="'.get_post_img( '', 150, 150 ).'" alt="'.$post->post_title .'" />';
                                }
                            ?>
                    </div>
                    <div class="zhida" id="buy_url_153007"> <a href="<?php echo home_url('/');?>go/<?php echo $post->ID?>" rel="nofollow" class="border_radius_3" target="_blank"> 直达链接 </a>
                      <div style="display:none"></div>
                    </div>
                  </div>
                  <div class="mall"><span class="grey">商城：</span><span class="from_val">
                    <?php $terms = get_the_terms( $post->ID, 'mall' );
                if ( $terms && ! is_wp_error( $terms ) ) : 
                    $draught_links = array();
                    foreach ( $terms as $term ) {
                        $draught_links[] = $term->name;
                        }
                    $on_draught = join( ", ", $draught_links );
                    echo $on_draught;
                endif; ?>
                    </span></div>
                </div>
                <div class="leftShowInfo" > <span class="has_from_val classified"> <span class="grey">分类：</span>
                  <?php the_category('，'); ?>
                  </span> <span class="featured">推荐人：
                  <?php if(get_post_meta($post->ID,'_post_author',true)){ echo get_post_meta($post->ID,'_post_author',true); }else{ the_author();} ?>
                  </span>
                  <div class="clear"></div>
                </div>
                <div class="conBox excerptBox" id="content_<?php echo $post->ID;?>" >
                  <div class="desc content_font ">
                    <?php the_content();?>
                  </div>
                  <div class="pro1_con"> <a onclick="return change_show_mode('showDetails', 'content_<?php echo $post->ID;?>');" href="#" class="showDetails" style="">
                    <div style="color:#1b8be0">展开全文</div>
                    </a> <a onclick="return change_show_mode('closeDetails', 'content_<?php echo $post->ID;?>');" href="#" class="closeDetails" style="display: none; ">向上收起</a> </div>
                </div>
              </div>
              <div class="clear"></div>
              <div class="Score">
                <div style="float:left; padding-top:10px">
                  <?php 
						$voteup = $post->vote_up; 
						$votedown = $post->vote_down;
						$voteall = $voteup + $votedown;
				?>
                  <span  style="float: left; padding:2px 0px 0 0;  width: 75px; background: url(<?php echo get_template_directory_uri();?>/images/like.png) 57px 5px no-repeat; color:#555;">评价本文</span> <span class="vote_up"  id="vote_up<?php the_ID(); ?>"><a href="#" title="值得" rel="up_<?php the_ID(); ?>"> <span  style="width:20px ; margin-left:10px" id="vup<?php the_ID(); ?>"><?php echo $voteup; ?></span></a>人认为值得买！</span> <span class="vote_down" id="vote_down<?php the_ID(); ?>"><a href="#" title="不值" rel="down_<?php the_ID(); ?>"> <span style="width:20px ; margin-left:10px"   id="vdown<?php the_ID(); ?>"><?php echo $votedown; ?></span></a>人认为不值得买！</span> <span class="allvotes"  id="allvotes<?php the_ID(); ?>"> <span id="va<?php the_ID(); ?>"> <?php echo $voteall; ?> </span> 位网友中的 <span style="color:#B30B09"  id="vup1<?php the_ID(); ?>"><?php echo $voteup; ?></span> 位认为值得买！ </span>
                  <script type="text/javascript">

				jQuery( document ).ready( function() {		
				// voting post
				var ue_token = 1;				
				jQuery( '#vote_up<?php the_ID(); ?> a' ).click( function() {		
					
					if(ue_token != 1) {
						alert("您的鼠标点得也太快了吧？！");
						return false;
					}
					ue_token = 0;
				
					var full_info = jQuery( this ).attr( 'rel' );
					var arr_param = full_info.split( '_' );						
					jQuery.post( "<?php echo get_bloginfo( 'template_url' ) ?>/include/vote.php", { act: arr_param[ 0 ], pid: arr_param[ 1 ] }, 
						function( data ) {
							if( data ) {
								var upd_vu = '#vup' + arr_param[ 1 ];
								jQuery( upd_vu ).text( data );
								ue_token = 1;
														
							 	var upd_vu = '#vup1' + arr_param[ 1 ];
								jQuery( upd_vu ).text( data );
								ue_token = 1;
		
								var upd_va = '#va' + arr_param[ 1 ];							
								jQuery( upd_va ).text(<?php echo $voteall+1 ?>);
								ue_token = 1;
								
							}else{
								alert("你已经表过态了！");
								ue_token = 1;
							}
						} );							
					return false;						
				} );	
					
					
				jQuery( '#vote_down<?php the_ID(); ?> a' ).click( function() {	
					
					if(ue_token != 1) {
						alert("您的鼠标点得也太快了吧？！");
						return false;
					}
					ue_token = 0;
								
					var full_info = jQuery( this ).attr( 'rel' );
					var arr_param = full_info.split( '_' );						
					jQuery.post( "<?php echo get_bloginfo( 'template_url' ) ?>/include/vote.php", { act: arr_param[ 0 ], pid: arr_param[ 1 ] }, 
						function( data ) {							
							if( data ) {
								var upd_vd = '#vdown' + arr_param[ 1 ];
								jQuery( upd_vd ).text( data );
								ue_token = 1;
																	
								var upd_va = '#va' + arr_param[ 1 ];;
								jQuery( upd_va ).text( data ) ;
															
								var upd_va = '#va' + arr_param[ 1 ];							
								jQuery( upd_va ).text(<?php echo $voteall+1 ?>);
								ue_token = 1;
													
							}else{		
								ue_token = 1;						
								alert("你已经表过态了！");
							}
						} );						
					return false;						
				} );	
			} );		
			</script>
                </div>
                <div style="float:right; padding-top:6px" >
                  <div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare"> <span style="cursor: pointer; display: block; float: left; height: 18px; color:#666; padding-top:6px; padding-left: 22px; vertical-align:middle "> </span> <a class="bds_tsina"></a> <a class="bds_tqq"></a> <a class="bds_renren"></a> <span class="bds_more"></span> </div>
                </div>
              </div>
            </div>
          </div>
          <?php endif; endwhile; endif;?>
          <div class="clear"></div>
        </div>
        <div class="pageBox">
          <div class="page">
            <?php pagenavi();?>
          </div>
          <div class="clear"></div>
        </div>
      </div>
    </div>
    <?php get_sidebar();?>
    <div class="clear"></div>
  </div>
  <!--e container-->
</section>
<?php get_footer();?>
